import random

gold = 5000
i = 1

while i:
    x = random.randint(1, 100)
    while 1:
        if gold == 0:
            print("很抱歉，金币不足")
            i = 0
            break
        y = int(input("请输入猜测的数字："))
        if x < y:
            print("大了")
            gold -= 500
        elif x > y:
            print("小了")
            gold -= 500
        elif x == y:
            print(f"恭喜猜中，本轮幸运数字：{x}")
            gold += 3000
            print(f"想要继续下一轮游戏吗？\n输入1继续\n输入0退出")
            i = int(input())
            break

